var Student = require('../lib/mongo').Student;

module.exports = {
    // 注册一个用户
    create: function create(student) {
        return Student.create(student).exec();
    },

    // 通过学生学号获取学生信息
    getStudentById: function getStudentById(student_id) {
        return Student
            .findOne({ student_id: student_id })
            .addCreatedAt()
            .exec();
    },

    // 获取所有学生学号
    // TODO 分班级或分教师
    getAllStudents: function getAllStudents() {
        return Student
            .find()
            .addCreatedAt()
            .exec();
    }
};
